/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tcptestclient;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.nio.charset.Charset;

/**
 *
 * @author rafal
 */
public class TCPTestClient extends Thread {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        try {
            Socket socket = null;
            PrintWriter out = null;

            socket = new Socket("127.0.0.1", 8000);

            out = new PrintWriter(socket.getOutputStream(), true);
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in, Charset.forName("UTF-8")));
            String userInput;
            String line;
            while ((userInput = stdIn.readLine()) != null) {
                out.println(userInput);
            }
            
            

            
            out.close();
            stdIn.close();
            socket.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }
}
